
    <div class="app-container">
        <el-row :gutter="20">
            <el-col :lg="4" :sm="24">
                <div class="head-container">
                    <el-input
                    v-model="treeFilterKeywords"
                    placeholder="请输入关键词"
                    clearable
                    prefix-icon="el-icon-search"
                    style="margin-bottom: 20px" 
                    />
                </div>
                <div class="head-container">
                    <el-tree :data="company_departTreeOptions"
                    :props="defaultTreeProps"
                    :expand-on-click-node="false"
                    :filter-node-method="filterNode"
                    ref="tree"
                    default-expand-all
                    @node-click="handleNodeClick" 
                    />
                </div>
            </el-col>
            <!--用户数据-->
            <el-col :lg="20" :sm="24">
                <el-form :model="queryParams" size="small" label-position="right" inline ref="queryForm" v-show="showSearch" 
                        @submit.native.prevent>
                    <el-form-item label="关键词" prop="keywords">
                        <el-input v-model="queryParams.keywords" placeholder="请输入关键词" clearable />
                    </el-form-item>
<el-form-item label="状态" prop="stateCode">
    <el-select v-model="queryParams.stateCode" placeholder="请选择状态" clearable >
        <el-option v-for="item in data_state" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
    </el-select>
</el-form-item>

                    <el-form-item>
                        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                    </el-form-item>
                </el-form>
                <el-row :gutter="10" class="mb8">
                        <el-col :span="1.5">
                            <el-button type="primary" v-hasPermi="['depart:add']" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
                        </el-col>
                        <el-col :span="1.5">
                            <el-button type="success" :disabled="single" v-hasPermi="['depart:edit']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
                        </el-col>
                        <el-col :span="1.5">
                            <el-button type="danger" :disabled="multiple" v-hasPermi="['depart:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
                        </el-col>
                    <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
                </el-row>

                <!-- 数据区域 -->
                <el-table :data="dataList" v-loading="loading" ref="table" border highlight-current-row @sort-change="sortChange" @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="50" align="center"/>
<el-table-column prop="belongCompanyName" label="公司" align="center" />
<el-table-column prop="paDepartName" label="上级部门" align="center" />
<el-table-column prop="departName" label="部门名称" align="center"  :show-overflow-tooltip="true" />
<el-table-column prop="createTime" label="创建时间" align="center"  :show-overflow-tooltip="true" />
<el-table-column prop="creater" label="创建人" align="center"  :show-overflow-tooltip="true" />
<el-table-column prop="stateCode" label="状态" align="center">
    <template slot-scope="scope">
        <el-switch v-model="scope.row.stateCode" :active-value="'Enabled'" :inactive-value="'Disabled'" @change="handleStatusChange(scope.row)"></el-switch>
    </template>
</el-table-column>

                    <el-table-column label="操作" align="center" width="140">
                        <template slot-scope="scope">
                                <el-button size="mini" v-hasPermi="['depart:edit']" type="text" icon="el-icon-edit" title="编辑" 
                                @click="handleUpdate(scope.row)">编辑</el-button>      
                                <el-button size="mini" v-hasPermi="['depart:delete']" type="text" icon="el-icon-delete" title="删除" 
                                @click="handleDelete(scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />

            </el-col>
        </el-row>
        <!-- 添加或修改部门对话框 -->
        <el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
            <el-form ref="form" :model="form" :rules="rules" label-width="100px">
                <el-row :gutter="20" style="display: flex; flex-wrap: wrap;">
<el-col :lg="12">
    <el-form-item label="公司" prop="companyId">
            <treeselect v-model="form.companyId" 
                :options="companyTreeSelectFormOptions" 
                :show-count="true" 
                :normalizer="normalizer"
                :flat="true" 
                :no-options-text="noOptionsText"
                :no-children-text="noChildrenText"
                :no-results-text="noResultsText"
                :loading-text="loadingText"
                @select="handlecompanyTreeSelectSelected"
                placeholder="请选择公司" />
    </el-form-item>
</el-col>
<el-col :lg="12">
    <el-form-item label="上级部门" prop="paDepartId">
            <treeselect v-model="form.paDepartId" 
                :options="orgDepartTreeSelectFormOptions" 
                :show-count="true" 
                :normalizer="deptTreeNormalizer"
                :flat="true" 
                :no-options-text="noOptionsText"
                :no-children-text="noChildrenText"
                :no-results-text="noResultsText"
                :loading-text="loadingText"
                :disabled="!this.form.companyId"
                @select="handleorgDepartTreeSelectSelected"
                placeholder="请选择部门" />
    </el-form-item>
</el-col>
<el-col :lg="12">
    <el-form-item label="部门名称" prop="departName">
        <el-input v-model="form.departName" placeholder="请输入部门名称" />
    </el-form-item>
</el-col>
<el-col :lg="12">
    <el-form-item label="负责人" prop="manager">
        <el-input v-model="form.manager" placeholder="请输入负责人" />
    </el-form-item>
</el-col>
<el-col :lg="12">
    <el-form-item label="电话" prop="tel">
        <el-input v-model="form.tel" placeholder="请输入电话" />
    </el-form-item>
</el-col>
<el-col :lg="12">
    <el-form-item label="邮箱" prop="email">
        <el-input v-model="form.email" placeholder="请输入邮箱" />
    </el-form-item>
</el-col>
<el-col :lg="12">
    <el-form-item label="传真" prop="fax">
        <el-input v-model="form.fax" placeholder="请输入传真" />
    </el-form-item>
</el-col>
<el-col :lg="24">
    <el-form-item label="备注" prop="remark">
        <el-input type="textarea" v-model="form.remark" placeholder="请输入备注"/>
    </el-form-item>
</el-col>
<el-col :lg="12">
    <el-form-item label="状态" prop="stateCode">
        <el-radio-group v-model="form.stateCode">
            <el-radio v-for="item in data_state" :key="item.dictValue" :label="item.dictValue">{{item.dictLabel}}</el-radio>
        </el-radio-group>
    </el-form-item>
</el-col>

                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="text" @click="cancel">取 消</el-button>
                <el-button type="primary" @click="submitForm">确 定</el-button>
            </div>
        </el-dialog>

    </div>